﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AthCommander.UI.Properties;
using AthCommander.Model;
using System.IO;
using System.Diagnostics;
using System.Threading.Tasks;
using AthCommander.Infrastructure;
using AthCommander.DirectoryGrid;

namespace AthCommander.UI
{
    public partial class AthCommanderView : Form
    {
        private Grid _selectedGrid;

        public AthCommanderView()
        {
            InitializeComponent();
            Icon = Resources.main_ico;
        }

        #region EventHandlers

        private void homeButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                _selectedGrid.GoHome();
                this.Cursor = Cursors.Arrow;
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
                this.Cursor = Cursors.Arrow;
            }
        }

        private void upButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                _selectedGrid.GoUp();
                this.Cursor = Cursors.Arrow;
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
                this.Cursor = Cursors.Arrow;
            }
        }

        private void backButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                _selectedGrid.GoBack();
                this.Cursor = Cursors.Arrow;
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
                this.Cursor = Cursors.Arrow;
            }
        }

        private void forwardButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                _selectedGrid.GoFoward();
                this.Cursor = Cursors.Arrow;
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }

        private void notepadButton_Click(object sender, EventArgs e)
        {
            try
            {
                Process procces = Process.Start("notepad.exe");
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }

        private void paintButton_Click(object sender, EventArgs e)
        {
            try
            {
                Process procces = Process.Start("mspaint.exe");
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }

        private void gridRight_Click(object sender, EventArgs e)
        {
            var grid = sender as Grid;
            _selectedGrid = grid;
        }

        private void gridLeft_Click(object sender, EventArgs e)
        {
            var grid = sender as Grid;
            _selectedGrid = grid;
        }

        #endregion

        #region Private Helpers

        #endregion


    }
}
